﻿//
// Created by QU on 24-10-5.
//

#ifndef SIGNALHANDLER_H
#define SIGNALHANDLER_H


#include <csignal>
#include <mutex>

class SignalHandler
{
public:
    SignalHandler();

    void waitForSignal();

    static void handleSignal(int sig);

    static SignalHandler& getInstance();

private:
    std::atomic<bool> m_stop_requested;
    std::condition_variable m_quit_cv;
    std::mutex m_quit_mutex;
};


#endif //SIGNALHANDLER_H
